package com.example.demo.config;

import com.alibaba.druid.pool.DruidDataSource;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:
 * @Author: kai.yang
 * @Date: 2019-08-13 10:10
 */
@Configuration
public class DataSourceConfig {


    @Bean
    public DataSource dataSource() throws SQLException {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://local.p2.cn:3306/demotp");
        dataSource.setUsername("root");
        dataSource.setPassword("yeepay.com");
        dataSource.init();
        return dataSource;
    }
}
